/*
 * Player.h
 *
 *  Created on: 24 jan 2010
 *      Author: Fidd
 */

#ifndef PLAYER_H_
#define PLAYER_H_

#include <string>
#include "engine/graphics/Sprite.h"
#include <SDL/SDL.h>
#include "engine/graphics/Particle.h"
#include <vector>
#include "bullet.h"

using namespace std;

class Player : public Sprite {
public:
	Player(int type);
	Player(int keys[], int type);
	virtual ~Player();

	// Constants
	static const int SHIP_RED = 1;
	static const int SHIP_BLUE = 2;


	//void setCollisionmap(BufferedImage c);
	void updatePos(int elapsed);
	void setKeysDown(Uint8 *keysPressed);
	void setKeysDown(int keysPressed[]);
	void resetKeys();
	int getKeyDown(int key);
	void draw();
	void addBullet(int x, int y, float angle, int dx, int dy, int type);
	void removeBullet(int i) { bullets.erase(bullets.begin()+i); }

	void setName(string n);
	string getName();
	void setSpeed(float speed);
	vector<Bullet*> getBullets(){return bullets;}
	int getSendBullet(){return sendbullet;}
	void setSendBullet(int b){sendbullet=b;}
	float getdx();
	float getdy();
	void setKey(int binding, int key);
	bool getKey(int i);
	int getAllowfire();
	void setAllowfire();
	int getAllowfiretime();
	void setAllowfiretime(int i);
	int getHeight();int getWidth();
	int getDeadTimeout();
	void setDeadTimeout();
	void updatedeath();
	//void drawPlayer(Graphics2D g2d, Player e);
	//void draw(Graphics2D g2d, Image background, LinkedList<Player> player);
	//void drawExplosion(Graphics g, Player p);
	//void setScreenSize(Rectangle r);
	int getMidx();
	int getMidy();
private:
	string name;
	int firetime;
	int allowfire;
	int firepos;
	int keysDown[5];
	int sendbullet;
	//int allowfire;
	//int allowfiretime;
	//float speed;
	//float motion;
	//bool key[5];
	int keysetup[5];
	//int height,width;
	//int deadtimeout;
	//int scrx,scry,scrw,scrh;
	//int midx, midy;
	Sprite *collisionmap;
	Sprite *explosion;
	vector<Particle*> blast;
	vector<Bullet*> bullets;
};

#endif /* PLAYER_H_ */
